package com.nacos.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description:
 *
 * @Author: future
 * @Date:2022/8/13:8:38
 */
@RestController
@RefreshScope
public class DemoController {

    @Value("${server.port}")
    private Integer port;

    @Value("${provider.user.name}")
    private String name;

    @Value("${provider.user.age}")
    private Integer age;

    @RequestMapping("/test")
    public String testConfig() {
        return "name:" + name + ",age:" + age;
    }

    @GetMapping(value = "/getPort")
    public Integer getServerPort() {
        return port;
    }
}
